<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"          			
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"   
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="TaskProLayout.xhtml">
        <ui:define name="content"> 
            <h:form id="studentForm">
                <div class="Post">
                    <h:outputText value="Insert team name: "/>
                    <p:inputText value="#{teamBean.newTeam.name}" required="true"></p:inputText>
                </div>
                <div class="Post">
                    <p:dataTable id="studentTable" value="#{teamBean.finalStudents}" var="student"
                                 rowKey="#{student.login}" paginator="true" paginatorAlwaysVisible="false" rows="10">
                        <p:column headerText="Student login">
                            <h:outputText value="#{student.login}" >
                                <f:converter converterId="StringConverter" />
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Student name">
                            <h:outputText value="#{student.name}" />
                        </p:column>
                        <p:column headerText="Student surname">
                            <h:outputText value="#{student.surname}" />
                        </p:column>
                        <p:column headerText="Student group">
                            <h:outputText value="#{teamBean.groupSelected.code}" />
                        </p:column>
                        <p:column headerText="Subject">
                            <h:outputText value="#{teamBean.groupSelected.subject.code}" />
                        </p:column>
                        <f:facet name="footer">  
                            <h:outputText value=" "/>
                        </f:facet>  
                    </p:dataTable>
                     <p:commandButton value="Create team" ajax="false" update=":messageForm:msgs" action="#{teamBean.createTeam()}"/>  
                </div>
            </h:form>
        </ui:define>
    </ui:composition>
</html>